<template>
  <div>
    <div class="serach-bg">
      <div class="serach-box">
        <input type="text" placeholder="家常菜，土豆丝，炒肉片" v-model="sname">
        <button @click="search()">
          <i class="iconfont iconsousuo1"></i>
        </button>
      </div>
    </div>
  </div>
</template>

<script>
import { Dialog } from 'vant';
  export default {
    data() {
      return {
        sname: ""
      }
    },
    methods: {
      search() {
        if (this.sname == "") {
          Dialog({
            message: '关键词不能为空'
          });
        } else {
          this.$router.push({
            path: `/search/result/${this.sname}`
          })
        }
      }

    }
  }

</script>
<style lang="scss">

</style>
